<template>
	<div class="fields-bottom-input" :class="{'border-tips': !fieldsObj.settings.value}" v-if="fieldsObj.type">
		<p v-if="!fieldsObj.settings.value" class="input-tips">
			请选择内容
		</p>
    <el-cascader
      v-else
      size="small"
      disabled
      v-model="fieldsObj.settings.value"
      :options="fieldsObj.settings.cascades"
      :props="{multiple: fieldsObj.settings.multiple}"
      :filterable="fieldsObj.settings.filterable"
      ></el-cascader>
	</div>
</template>

<script>
export default {
  name: 'CCascadeChoice',
  props: {
    fields: {
      default: () => {
        return {}
      },
    },
  },
  watch: {
    'fields': {
      handler (val) {
        this.fieldsObj = val
      },
      deep: true,
      immediate: true
    }
  },
  data () {
    return {
      fieldsObj: {}
    }
  },
  mounted () {
    this.fieldsObj = this.fields
  }
}
</script>

<style lang="less" scoped>
.input-tips {
  color: #CBCFD6;
  text-overflow: -o-ellipsis-lastline;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  padding: 0 16px;
}

.fields-bottom-input {
  overflow: hidden !important;
  padding: 0 !important;
}
.border-tips {
  border: 1px solid #dcdfe6;
}

:deep .el-cascader--small {
  width: 100%;
}
</style>
